Skip to content

fix: use PID-based session liveness detection#1

Closed
morinpic wants to merge 1 commit into
mainfrom
fix/session-liveness-detection
Closed

fix: use PID-based session liveness detection#1
morinpic wants to merge 1 commit into
mainfrom
fix/session-liveness-detection

Conversation

@morinpic

Copy link
Copy Markdown
Contributor

Summary

  • 旧ロジック: ps aux から UUID を grep → leadSessionId とマッチ → in-process バックエンドは UUID が ps に出ないため常にゴースト扱い
  • 新ロジック: ~/.claude/sessions/<PID>.json を読み、PID 生存確認(kill -0)+ cwd + createdAt≈startedAt(5秒以内) でチームとセッションを紐付け
  • スキャン出力に repo(リポジトリ名)と cwd を追加

Test plan

  • アクティブなチーム(in-process backend)がゴースト扱いされないこと
  • 実際に死んだチームが正しくゴースト検出されること
  • ~/.claude/sessions/ が存在しない環境でエラーにならないこと(フォールバック)
  • 同じ cwd で複数チームがある場合の誤マッチがないこと(createdAt 検証)

The previous approach grepped ps aux for UUIDs and matched them against
team leadSessionId. This fundamentally failed for in-process backends
because their session UUIDs never appear in process command lines,
causing all in-process teams to be falsely reported as ghosts.

New approach:
- Read ~/.claude/sessions/<PID>.json as the source of truth
- Verify PID is alive via kill -0
- Match teams to sessions by cwd + createdAt≈startedAt (within 5s)
- Add repo name and cwd to scan output for better visibility
@morinpic

Copy link
Copy Markdown
Contributor Author

J.A.R.V.I.S. が直接コード編集してしまったのでやり直します。プロジェクトの Claude に委譲して正しく再作成します。

@morinpic morinpic closed this Jun 18, 2026
@morinpic morinpic deleted the fix/session-liveness-detection branch June 18, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant